#coding=utf-8
'''
立方体相关配置信息
'''

settingsindb = {
      'mixi_farm_subkb': [
                {
                    'iam':'dim', # 标明是维度信息
                    'name':'付费时间', 
                    'label':'用户付费时间', 
                    'desc':'用户付费时间', 
                    'dbname':'default', 
                    'tbname':'subkbrecords', 
                    'colname':'subtime',
                    'concepts': {'年':{'type':'sql', 'define':'year(%(colname)s)'},
                       '季度': {'type':'sql', 'define':'case when month(%(colname)s) in (1,2,3) then 1 when month(%(colname)s) in (4,5,6) then 2 when month(%(colname)s) in (7,8,9) then 3 when month(%(colname)s) in (10,11,12) then 4 end'},
                       '月': {'type':'sql', 'define':'month(%(colname)s)'},
                       '周': {'type':'sql', 'define':'weekofyear(%(colname)s)'},
                       '星期几': {'type':'sql', 'define':'dayofweek(%(colname)s)'},
                       '日': {'type':'sql', 'define':'day(%(colname)s)'},
                       }
                },
                
                {
                    'iam':'measure', # 标明是度量信息
                    'name': '付费额', # 付费额度
                    'label': '用户付费额度',
                    'desc':'对用户付费额度的描述',
                    'dbname':'default',
                    'tbname':'subkbrecords',
                    'colname':'kbnum',
                    'ways':{'计数': {'type':'sql','define':'count(1)'},
                            '求均值': {'type':'sql', 'define':'avg(%(colname)s)'},
                            '求和':{'type':'sql', 'define':'sum(%(colname)s)'},
                            } # 度量的方式
                }
                ]
}